package com.brillilab.common.utils;

import org.apache.commons.codec.binary.Base64;

import java.io.UnsupportedEncodingException;

/**
 * @description 加解密工具类
 * @author Wu Menghao
 * @time 2019/07/08
 */
public class DigestUtils {

    public static String base64Encode(String content){
        try {
            return Base64.encodeBase64String(content.getBytes("utf-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String base64Decode(String content){
        try {
            return new String(Base64.decodeBase64(content),"utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }
}
